package com.lisn.sgseetaface.widget;

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;
import android.view.SurfaceHolder;

/**
 * Author: LiShan 
 * Time: 2020/8/31  
 * Description: 
 */
public class SGView extends GLSurfaceView {

    //默认正常速度
    private Speed mSpeed = Speed.MODE_NORMAL;

    public enum Speed {
        MODE_EXTRA_SLOW, MODE_SLOW, MODE_NORMAL, MODE_FAST, MODE_EXTRA_FAST
    }


    SGRender mRender;
    public SGView(Context context) {
        this(context, null);
    }

    public SGView(Context context, AttributeSet attrs) {
        super(context, attrs);

        //设置EGL版本
        setEGLContextClientVersion(2);
        mRender = new SGRender(this);
        setRenderer(mRender);
        //
        //设置按需渲染，当我们调用requestRender();请求GLThread回调一次onDrawFrame
        setRenderMode(RENDERMODE_WHEN_DIRTY);
    }


    @Override
    public void surfaceDestroyed(SurfaceHolder holder) {
        super.surfaceDestroyed(holder);
        mRender.onSurfaceDestroyed();
    }

    public void TakingPhoto() {
        mRender.setTakingPhoto(true);
    }

}
